<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>validate入门案例</title>
		<script type="text/javascript" src="../jQuery/jquery-1.11.3.js" ></script>
		<!--validate.js是建立在jquery之上的，所以得先导入jquery的类库-->
		<script type="text/javascript" src="jquery.validate.min.js" ></script>
		<!--引入国际化js文件-->
		<script type="text/javascript" src="messages_zh.js" ></script>
		<script>
			$(function(){
				$("#checkForm").validate({
					rules:{
						username:{
							required:true,
							minlength:6
						},
						password:{
							required:true,
							digits:true,
							minlength:6
						}
					},
					messages:{
						username:{
							required:"用户名不能为空!",
							minlength:"用户名不得少于6位！"
						},
						password:{
							required:"密码不能为空!",
							digits:"密码必须是整数!",
							minlength:"密码不得少于6位!"
						}
					}
				});
			});
		</script>
		
	</head>
	<body>
		<form action="#" id="checkForm">
			用户名：<input type="text" name="username" /><br />
			密码：<input type="password" name="password"/><br />
			<input type="submit"/>
		</form>
	</body>
</html>
